#ifndef pins_h
#define pins_h

#define RX 0
#define TX 1
#define Valve1 2
// #define Valve2 3
#define Alarm 4
#define Refrigeration 5
#define Fan1 6
#define DuctHeater 7
#define DAC_SDA 8
#define DAC_SCL 9
#define ADC_SDA 10
#define ADC_SCL 11
#define VacuumPump 16
#define ReactorHeater 17
#define Fan2_High 18
#define Fan2_Low 19
#define UV_lamp 20
#define Lighting 21
#define LED_PIN 25
#define TempReactor 26
#define TempDuct 27
#define TempPump 28


//初始化引脚
void setup_pins()
{
    pinMode(Valve1, OUTPUT);
    // pinMode(Valve2, OUTPUT);
    pinMode(Alarm, OUTPUT);
    pinMode(Refrigeration, OUTPUT);
    pinMode(Fan1, OUTPUT);
    pinMode(DuctHeater, OUTPUT);
    // pinMode(EmergencyStop, OUTPUT);
    pinMode(ReactorHeater, OUTPUT);
    pinMode(VacuumPump, OUTPUT);
    pinMode(Fan2_High, OUTPUT);
    pinMode(Fan2_Low, OUTPUT);
    pinMode(UV_lamp, OUTPUT);
    pinMode(Lighting, OUTPUT);
    pinMode(LED_PIN, OUTPUT);

}

//获取引脚名称
int getPinByName(const String& name) {
    if (name == "Valve1") return Valve1;
    if (name == "Alarm") return Alarm;
    if (name == "Refrigeration") return Refrigeration;
    if (name == "DuctHeater") return DuctHeater;
    // if (name == "EmergencyStop") return EmergencyStop;
    if (name == "ReactorHeater") return ReactorHeater;
    if (name == "VacuumPump") return VacuumPump;
    if (name == "Fan2_High") return Fan2_High;
    if (name == "Fan2_Low") return Fan2_Low;
    if (name == "UV_lamp") return UV_lamp;
    if (name == "Lighting") return Lighting;
    // 其他引脚...
    return -1; // 未找到
}

#endif
